preserve
foreach var in PAY_PIECE_RATE  PAY_QUALITY_BONUS  PAY_OTHER_BONUS {
    replace `var' = `var'-1
}

local O PAY_BASIC PAY_PIECE_RATE  PAY_QUALITY_BONUS  PAY_OTHER_BONUS
foreach o of local O{
estpost tabstat `o'  if  SAMPLE==1   ///
, listwise statistics(N mean sd p10 p25 median p75 p90)  columns(statistics)
esttab, cells("count(fmt(%9.0gc)) mean(fmt(a2)) sd(fmt(a2)) p10(fmt(a2)) p25(fmt(a2)) p50(fmt(a2)) p75(fmt(a2)) p90(fmt(a2))") nomtitle nonumber noobs label varwidth(24) tex fragment
}
 

eststo O_TB5_B1: estpost tabstat `O' if SAMPLE==1 , statistics(N mean sd p10 p25 median p75 p90) columns(statistics)
esttab O_TB5_B1 using "${tables}\TableB5PanelB1.tex", cells("count(fmt(%9.0gc)) mean(fmt(a2)) sd(fmt(a2)) p10(fmt(a2)) p25(fmt(a2)) p50(fmt(a2)) p75(fmt(a2)) p90(fmt(a2))")  nomtitles label nonumbers noobs unstack replace posthead(" ") nodep collabels(none) prehead(" ") postfoot(" ")
restore